import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EventVO, EventForm, EventQuery } from '@/api/system/event/types';

/**
 * 查询风险事件列表
 * @param query
 * @returns {*}
 */

export const listEvent = (query?: EventQuery): AxiosPromise<EventVO[]> => {
  return request({
    url: '/system/event/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询风险事件详细
 * @param id
 */
export const getEvent = (id: string | number): AxiosPromise<EventVO> => {
  return request({
    url: '/system/event/' + id,
    method: 'get'
  });
};

/**
 * 新增风险事件
 * @param data
 */
export const addEvent = (data: EventForm) => {
  return request({
    url: '/system/event',
    method: 'post',
    data: data
  });
};

/**
 * 修改风险事件
 * @param data
 */
export const updateEvent = (data: EventForm) => {
  return request({
    url: '/system/event',
    method: 'put',
    data: data
  });
};

/**
 * 删除风险事件
 * @param id
 */
export const delEvent = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/event/' + id,
    method: 'delete'
  });
};
